package cfca.seal.util;

import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateNumberModel;
import freemarker.template.TemplateScalarModel;
import java.util.Map;

public class DirectiveUtil
{
  public static String getString(String name, Map<String, TemplateModel> params)
    throws TemplateException
  {
    TemplateModel model = (TemplateModel)params.get(name);
    if (model == null) {
      return null;
    }
    if ((model instanceof TemplateScalarModel))
      return ((TemplateScalarModel)model).getAsString();
    if ((model instanceof TemplateNumberModel)) {
      return ((TemplateNumberModel)model).getAsNumber().toString();
    }
    return "";
  }
}